package com.example.hello;

import com.example.hello.client.TabLink.BootstrapTabLinkRpc;
import com.example.hello.client.TabLink.BootstrapTabLinkState;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.ui.AbstractComponent;

public class BootstrapTabLink extends AbstractComponent {

    private BootstrapTabLinkRpc rpc = new BootstrapTabLinkRpc() {
        public void click(MouseEventDetails details) {
            fireEvent(new BootstrapEvent(BootstrapTabLink.this));
        }
    };

    public BootstrapTabLink() {
        this("////");
    }

    public BootstrapTabLink(String text) {
        setText(text);

        registerRpc(rpc);
    }

    @Override
    protected BootstrapTabLinkState getState() {
        return (BootstrapTabLinkState) super.getState();
    }

    public boolean isActive() {
        return getState().isActive();
    }

    public void setActive(boolean active) {
        getState().setActive(active);
    }

    public String getDataTarget() {
        return getState().getDataTarget();
    }

    public void setDataTarget(String dataTarget) {
        getState().setDataTarget(dataTarget);
    }

    public String getText() {
        return getState().getText();
    }

    public void setText(String text) {
        getState().setText(text);
    }

    public boolean isCreateTabPane() {
        return getState().isCreateTabPane();
    }

    public void setCreateTabPane(boolean createTabPane) {
        getState().setCreateTabPane(createTabPane);
    }

    public BootstrapTabPane getTabPane() {
        return (BootstrapTabPane) getState().getTabPane();
    }

    public void setTabPane(BootstrapTabPane tabPane) {
        getState().setTabPane(tabPane);
    }

}
